import {useState, useEffect} from "react";
import axios from "axios";

const useWeather = () => {
    const [WeatherList, setWeatherList] = useState({
        address:'',
        weather:'',
        humidity:'',
        temp: '',
        windPower: ''

    })
    useEffect(() => {

        async function getWeatherList() {
            const res = await axios.get('http://127.0.0.1:4523/m1/5034281-0-default/get_weather')
            setWeatherList(res.data.data)

        }

        getWeatherList()

    }, [])

    return {WeatherList}
}

export default useWeather